<template>
  <div class="app-container">
<div class="contina">
  <div class="totle">
    <div class="div1" @click="dialogVisible = true">产线管理</div>
    <div class="div1"  @click="open">MES接口配置</div>
  </div>
  <div style="display: flex;justify-content: space-between; align-items: center; height: 60px; border-bottom: 1px solid #000;">
    <div>Line: ws-02-01</div>
    <div style="margin: 0 10px;">station: PressTerminal</div>
    <div>machine: PressTerminal-01</div>
  </div>
  <div class="box-top">
  <div class="lertbox">
   <div class="top1">
    <div>1</div>
    <div>参数</div>
    <div>数据</div>
   </div>
   <div class="top1">
    <div>2</div>
    <div>SN</div>
    <div>Lux69227</div>
   </div>
   <div class="top1">
    <div>3</div>
    <div>WZ</div>
    <div>46.25</div>
   </div>
   <div class="top1">
    <div>4</div>
    <div>YL</div>
    <div>60.5</div>
   </div>
  </div>
  <div class="lertbox">
    <div style="height: 80px;width: 100%;border-bottom: 1px solid #000;text-align: center;line-height: 30px;">State  : 0</div>
    <div style="height: 30px;width: 100%;border-bottom: 1px solid #000;text-align: center;line-height: 30px;">ckeckin ----------  OK</div>
    <div style="height: 30px;width: 100%;border-bottom: 1px solid #000;text-align: center;line-height: 30px;">Feeuingcheck -----  NG</div>
    <div style="height: 30px;width: 100%;border-bottom: 1px solid #000;text-align: center;line-height: 30px;">checkout---------   ok</div>
    
  </div>
</div>
<div class="meslog">
  <div class="mestitle">MES日志</div>
  <div class="infotitel">
    <div>时间</div>
    <div>事件</div>
    <div>状态</div>
    <div>详细信息</div>
  </div>
  <div class="infotitel">
    <div>15:30:20</div>
    <div>checkin</div>
    <div>FAll</div>
    <div>{"event":"sn-checkin","ruslt":"fall"}</div>
  </div>
</div>
</div>
<el-dialog
  title="提示"
  :visible.sync="dialogVisible"
  width="60%"
  :before-close="handleClose">
  <span>基本信息</span>
   <div class="dialogbox">
  <div class="dialog">
    <div class="dialog-tilie">
      <div style="width: 60px;margin-top: 10px;">Line</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>
    <div class="dialog-tilie" style="margin-top: 10px;">
      <div style="width: 60px;margin-top: 10px;">Station</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>
    <div class="dialog-tilie" style="margin-top: 10px;">
      <div style="width: 60px;margin-top: 10px;">machid</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>
    <div class="dialog-tilie" style="margin-top: 10px;">
      <div style="width: 60px;margin-top: 10px;">OPid</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>


    <div>
      <h2>PLC配置</h2>
      <div class="dialog-tilie" style="margin-top: 10px;">
      <div style="width: 60px;margin-top: 10px;">IP</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>
    <div class="dialog-tilie" style="margin-top: 10px;">
      <div style="width: 60px;margin-top: 10px;">端口</div>
      <el-input v-model="input" placeholder="请输入内容" style="width: 200px;"></el-input>
    </div>
    </div>
  </div>

  <div style="margin-top: 10px;margin-left: 20px;width: 50%;">
    <h2>ckeckout 数据</h2>
    <div class="tatbl">
      <div>数据名称</div>
      <div>地址</div>
      <div>类型</div>
      <div>长度</div>
    </div>
    <div class="tatbl">
      <div>扭力</div>
      <div>DM8011</div>
      <div>Folt</div>
      <div>6</div>
    </div>
    <div class="tatbl">
      <div>张力</div>
      <div>DM8009</div>
      <div>Folt</div>
      <div>6</div>
    </div>
  </div>
</div>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
</el-dialog>
    <!-- <el-row :gutter="20">
      <el-col :span="6" :xs="24">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>个人信息</span>
          </div>
          <div>
            <div class="text-center">
              <userAvatar />
            </div>
            <ul class="list-group list-group-striped">
              <li class="list-group-item">
                <svg-icon icon-class="user" />用户名称
                <div class="pull-right">{{ user.userName }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="phone" />手机号码
                <div class="pull-right">{{ user.phonenumber }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="email" />用户邮箱
                <div class="pull-right">{{ user.email }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="tree" />所属部门
                <div class="pull-right" v-if="user.dept">{{ user.dept.deptName }} / {{ postGroup }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="peoples" />所属角色
                <div class="pull-right">{{ roleGroup }}</div>
              </li>
              <li class="list-group-item">
                <svg-icon icon-class="date" />创建日期
                <div class="pull-right">{{ user.createTime }}</div>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18" :xs="24">
        <el-card>
          <div slot="header" class="clearfix">
            <span>基本资料</span>
          </div>
          <el-tabs v-model="activeTab">
            <el-tab-pane label="基本资料" name="userinfo">
              <userInfo :user="user" />
            </el-tab-pane>
            <el-tab-pane label="修改密码" name="resetPwd">
              <resetPwd />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row> -->
  </div>
</template>

<script>
import userAvatar from "./userAvatar";
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";
import { getUserProfile } from "@/api/system/user";

export default {
  name: "Profile",
  components: { userAvatar, userInfo, resetPwd },
  data() {
    return {
      user: {},
      roleGroup: {},
      postGroup: {},
      activeTab: "userinfo",
      dialogVisible: false
    };
  },
  created() {
    this.getUser();
  },
  methods: {
    open() {
        this.$prompt('Url', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
          inputErrorMessage: '邮箱格式不正确'
        }).then(({ value }) => {
          this.$message({
            type: 'success',
            message: '你的邮箱是: ' + value
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消输入'
          });       
        });
      },
    getUser() {
      getUserProfile().then(response => {
        this.user = response.data;
        this.roleGroup = response.roleGroup;
        this.postGroup = response.postGroup;
      });
    },
    handleClose(done) {
        this.$confirm('确认关闭？')
          .then(_ => {
            done();
          })
          .catch(_ => {});
      }
  }
};
</script>


<style>
.dialog-tilie{
  display: flex;
  margin-top: 40px;
}
.contina{
  width: 100%;
  height: 600px;
  border: 1px solid #000;
}
.totle{
  display: flex;
  width: 100%;
  border-bottom: 1px solid #000;

}
.div1{
  cursor: pointer;
  transition: background-color 0.3s;
  height: 30px;
  border-right: 1px solid #000;
  padding: 0 20px;
  text-align: center;
  line-height: 30px;
  margin: 0 30px;
}
.hovered {
  background-color: blue;
  color: white;
}
.lertbox{
  width: 26%;
  height: 300px;
  border: 1px solid #000;
}
.box-top{
  display: flex;
  justify-content: space-between;
}
.top1{
  height: 40px;
  line-height: 40px;
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid #000;
}
.meslog{
  width: 100%;
  height: 400px;

}
.mestitle{
  margin-top: 20px;
  border-bottom: 1px solid #000;
  border-top: 1px solid #000;
}
.infotitel{
  height: 40px;
  line-height: 40px;
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid #000;
}
.dialogbox{
  display: flex;
}
.tatbl{
  display: flex;
  justify-content: space-around;
  height: 30px;
  line-height: 30px;
  border: 1px solid #000;
}
</style>
